-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: pass contract_name to VyperContract #338
fix: pass contract_name to VyperContract #338
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference between nickname and contract_name? Do we really need 2 names?
The ERC20: DAI etc |
Update: removed |
boa/environment.py
Outdated
@@ -212,6 +212,7 @@ def deploy( | |||
override_address: Optional[_AddressType] = None, | |||
# the calling vyper contract | |||
contract: Any = None, | |||
contract_name: Optional[str] = None, # TODO: This isn't used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably don't need this, we can call contract.contract_name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone passes contract_name = xxx
to the deploy of a non NetworkEnv
boa.env
, this would revert. So I think we do need this to make it compatible with the NetworkEnv
object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it would be an error to pass contract_name = xxx
to env.deploy().
boa/network.py
Outdated
@@ -402,7 +409,11 @@ def deploy( | |||
print(f"contract deployed at {create_address}") | |||
|
|||
if (deployments_db := get_deployments_db()) is not None: | |||
contract_name = getattr(contract, "contract_name", None) | |||
contract_name = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why would we want 2 names for the contract? This value contract_name
should be equal to contract.contract_name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean? This would only set 1 name. It defaults to the filename
unless one is passed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea i don't think contract_name should be passed to env.deploy(). it already exists on the contract object
contract_name = ( | ||
contract_name if contract_name else Path(compiler_data.contract_path).stem | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contract_name = ( | |
contract_name if contract_name else Path(compiler_data.contract_path).stem | |
) | |
if contract_name is None: | |
contract_name = Path(compiler_data.contract_path).stem) |
@@ -146,8 +146,11 @@ def __init__( | |||
compiler_data: CompilerData, | |||
env: Optional[Env] = None, | |||
filename: Optional[str] = None, | |||
contract_name: Optional[str] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should follow the same order as the super class tbh
some other style things move around arg order
add contract_name to VyperContract ctor. allows setting contract_name at deploy time. --------- Co-authored-by: Charles Cooper <[email protected]>
What I did
add
contract_name
to VyperContract ctor. allows setting contract_name at deploy time.How I did it
How to verify it
Description for the changelog
nickname
to contractsCute Animal Picture